package com.hsy.linemoney.modules.my.mydeals;

import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

import com.hsy.linemoney.R;
import com.hsy.linemoney.modules.common.CommonBaseFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * 我的交易 - 基类
 * Created by Administrator on 2016/7/11.
 */
public abstract class MyDealFragment<T> extends CommonBaseFragment {

    protected ListView listView;
    protected List<MyDealBean> data = new ArrayList<>();
    protected MyDealListAdapter<T> adapter;

    protected abstract int getType(int position);

    @Override
    protected int getFragmentLayout() {
        return R.layout.fragment_my_deal;
    }

    @Override
    protected void initView(View view, Bundle bundle) {
        listView = F(R.id.listView);
        adapter = new MyDealListAdapter<T>(getContext()) {
            @Override
            public int getType(int position) {
                return MyDealFragment.this.getType(position);
            }
        };
        listView.setAdapter(adapter);
    }
}
